#include "usart.h"

#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(unsigned char ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(unsigned char ch, FILE *f)
#endif
PUTCHAR_PROTOTYPE
{
    /* 实现串口发送一个字节数据的函数 */
    HAL_UART_Transmit(&huart1, &ch, 1, 100);
    return ch;
}
int _write(int file, char *ptr, int len)
{
    int DataIdx;
    for(DataIdx = 0; DataIdx < len; DataIdx++)
    {
        __io_putchar(*ptr++);
    }
    return len;
}
